package conchmusic.conchmusicclient.mainUi;

import android.app.Activity;
import android.app.Dialog;
import android.os.Bundle;
import android.util.Log;
import android.view.Display;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.EditText;

import conchmusic.conchmusicclient.R;

/**
 * Created by arsenal_tj on 2017/4/22.
 */

public class UpdatePopup extends Dialog {
    Activity context;
    private Button updateInfo;
    public static EditText songListNameUpdate;
    public static EditText songListDescripe;

    private View.OnClickListener mClickListener;

    public UpdatePopup(Activity context) {
        super(context);
        this.context = context;
    }

    public UpdatePopup(Activity context, int theme, View.OnClickListener clickListener) {
        super(context, theme);
        this.context = context;
        this.mClickListener = clickListener;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        this.setContentView(R.layout.update_popup);

        Window dialogWindow = this.getWindow();
        WindowManager m = context.getWindowManager();
        Display d = m.getDefaultDisplay(); // 获取屏幕宽、高用
        WindowManager.LayoutParams p = dialogWindow.getAttributes();
        p.height = (int) (d.getHeight() * 0.3); // 高度设置为屏幕的0.3
        p.width = (int) (d.getWidth() * 0.8); // 宽度设置为屏幕的0.8
        dialogWindow.setAttributes(p);
        updateInfo = (Button) findViewById(R.id.songListUpdate);
        songListNameUpdate = (EditText) findViewById(R.id.songListNameUpdate);
        songListDescripe = (EditText) findViewById(R.id.songListDescripe);
        updateInfo.setOnClickListener(mClickListener);

//        songListNameUpdate.setText(ss);
        this.setCancelable(true);
    }
    public static void setDescripe(){
        songListDescripe.setText("");
    }
    public static void settext(String s2){
        songListNameUpdate.setText(s2);
    }
}
